package com.twu.biblioteca;

/**
 * Created by thoughtworker on 1/15/14.
 */
public class LibraryBook {
    private String title;
    private boolean available;

    public LibraryBook(String title, boolean available) {
        this.title = title;
        this.available = available;
    }

    public String toString(){
        return title;
    }

    public boolean tryCheckOut() {
        boolean success = available;
        available = false;
        return success;
    }

    public boolean tryReturn() {
        boolean success = !available;
        available = true;
        return success;
    }

    public boolean isAvailable(){
        return available;
    }
}
